package com.estronger.shopmanage.ui.order.until;

import android.app.AlertDialog;
import android.content.Context;
import android.os.Bundle;
import android.widget.TextView;

import com.estronger.shopmanage.R;

public class LoadingDialog2 extends AlertDialog {

	private TextView tips_loading_msg;

	private String message = null;

	public LoadingDialog2(Context context) {
		super(context);
		message = "正在生成压缩图片，请稍候...";
	}

	public LoadingDialog2(Context context, String message, boolean cancelable) {
		super(context);
		this.message = message;
		this.setCancelable(cancelable);
	}

	public LoadingDialog2(Context context, int theme, String message) {
		super(context, theme);
		this.message = message;
		this.setCancelable(false);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.setContentView(R.layout.view_tips_uploading);
		tips_loading_msg = (TextView) findViewById(R.id.tips_loading_msg);
		// tips_loading_msg.setText(this.message);
		getWindow().setBackgroundDrawableResource(android.R.color.transparent);
	}

	public void setText(String message) {
		this.message = message;
		if (tips_loading_msg != null) {

			tips_loading_msg.setText(message);
		}
	}

	public void setText(int resId) {
		setText(getContext().getResources().getString(resId));
	}

	public void dialogFinish(LoadingDialog2 mDialog) {
		if (mDialog != null) {
			mDialog.dismiss();
		}
	}

}
